package one.stand.feign;

import one.stand.fallback.WechatFallBack;
import one.stand.request.wx.ShareDynamicRequest;
import one.stand.request.wx.UserTimerModel;
import one.stand.request.wx.WxAuthRequest;
import one.stand.request.wx.WxMsgRequest;
import one.stand.response.wx.AuthSnsapiUserinfoResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import one.stand.model.ResultModel;
import one.stand.request.ComponentProgramRequest;
import one.stand.request.ComponentVerifyTicketRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author Administrator
 */
@Component
@FeignClient(value = "wechat-service", fallback = WechatFallBack.class, decode404 = true)
public interface WechatFegin {
    @PostMapping("wx/wxcallback")
    String wxcallback(@RequestBody ComponentVerifyTicketRequest request);

    @PostMapping("wx/program")
    String program(@RequestBody ComponentProgramRequest request);

    @GetMapping("wx/subscribe-templates")
    ResultModel subscribeTemplates(@RequestParam("companyKey") String companyKey, @RequestParam("accountType") String accountType);


    @GetMapping("wx/wechatCallback")
    AuthSnsapiUserinfoResponse wechatCallback(@RequestParam("code") String code, @RequestParam("state") String state);

    @GetMapping("wx/wxAuth")
    AuthSnsapiUserinfoResponse wxAuth(@RequestParam("code") String code, @RequestParam("state") String state);

    @PostMapping("wx/msgAuthGet")
    String authGet(@RequestBody WxAuthRequest request);

    @PostMapping("wx/msgPost")
    String post(@RequestBody WxMsgRequest request);

    @PostMapping("wx/getWxJsapiSignature")
    ResultModel getWxJsapiSignature(@RequestBody WxMsgRequest request);

    @PostMapping("component/refreshSubscribeTemplates")
    ResultModel refreshSubscribeTemplates(@RequestBody WxMsgRequest request);

    @PostMapping("wx/updateShareNum")
    String updateShareNum(@RequestBody ShareDynamicRequest request);

    @PostMapping("wx/userOpenDynamic")
    String userOpenDynamic(@RequestBody UserTimerModel request);
}
